package br.foton.la.agenda.entity;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;

@Entity
@SequenceGenerator(name="telefoneGenerator",sequenceName="TELEFONE_SEQ",allocationSize=1)
public class Telefone implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(generator="telefoneGenerator",strategy=GenerationType.SEQUENCE)
	private int id;
	private int ddd;
	private int ddi;
	@Column(nullable=false)
	private String numero;
	
	public Telefone(int ddd, String numero) {
		setDdd(ddd);
		setNumero(numero);
	}
	
	public Telefone() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public String toString() {
		return "Telefone [id=" + id + ", ddd=" + ddd + ", ddi=" + ddi
				+ ", numero=" + numero + "]";
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getDdd() {
		return ddd;
	}

	public void setDdd(int ddd) {
		this.ddd = ddd;
	}

	@Basic(fetch=FetchType.LAZY)
	public int getDdi() {
		return ddi;
	}

	public void setDdi(int ddi) {
		this.ddi = ddi;
	}

	public String getNumero() {
		return numero;
	}

	public void setNumero(String numero) {
		this.numero = numero;
	}
	
}
